﻿CREATE TABLE [fb].[OrganizationPerson] (
    [OrganizationId] INT NOT NULL,
    [PersonId]       INT NOT NULL,
    CONSTRAINT [PK_fb.OrganizationPerson] PRIMARY KEY CLUSTERED ([OrganizationId] ASC, [PersonId] ASC),
    CONSTRAINT [FK_fb.OrganizationPerson_fb.Organization_OrganizationId] FOREIGN KEY ([OrganizationId]) REFERENCES [fb].[Organization] ([CounterpartyId]),
    CONSTRAINT [FK_fb.OrganizationPerson_fb.Person_PersonId] FOREIGN KEY ([PersonId]) REFERENCES [fb].[Person] ([CounterpartyId])
);


GO
CREATE NONCLUSTERED INDEX [IX_OrganizationId]
    ON [fb].[OrganizationPerson]([OrganizationId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_PersonId]
    ON [fb].[OrganizationPerson]([PersonId] ASC);

